<?php

/**
 * Users form base class.
 *
 * @method Users getObject() Returns the current form's model object
 *
 * @package    iEasy
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseUsersForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'user_id'          => new sfWidgetFormInputHidden(),
      'name'             => new sfWidgetFormInputText(),
      'nickname'         => new sfWidgetFormInputText(),
      'sex'              => new sfWidgetFormInputText(),
      'birthday'         => new sfWidgetFormInputText(),
      'telephone'        => new sfWidgetFormInputText(),
      'cellphone'        => new sfWidgetFormInputText(),
      'email'            => new sfWidgetFormTextarea(),
      'address'          => new sfWidgetFormTextarea(),
      'create_time'      => new sfWidgetFormDateTime(),
      'modify_time'      => new sfWidgetFormDateTime(),
      'password'         => new sfWidgetFormTextarea(),
      'real_name'        => new sfWidgetFormInputText(),
      'last_vote_time'   => new sfWidgetFormDateTime(),
      'last_survey_time' => new sfWidgetFormDateTime(),
      'last_login_time'  => new sfWidgetFormDateTime(),
      'avatar'           => new sfWidgetFormTextarea(),
      'is_activate_b'    => new sfWidgetFormInputText(),
      'login_ip'         => new sfWidgetFormInputText(),
      'join_ip'          => new sfWidgetFormInputText(),
      'member_level_i'   => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'user_id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('user_id')), 'empty_value' => $this->getObject()->get('user_id'), 'required' => false)),
      'name'             => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'nickname'         => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'sex'              => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'birthday'         => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'telephone'        => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'cellphone'        => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'email'            => new sfValidatorString(array('required' => false)),
      'address'          => new sfValidatorString(array('required' => false)),
      'create_time'      => new sfValidatorDateTime(array('required' => false)),
      'modify_time'      => new sfValidatorDateTime(array('required' => false)),
      'password'         => new sfValidatorString(array('required' => false)),
      'real_name'        => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'last_vote_time'   => new sfValidatorDateTime(array('required' => false)),
      'last_survey_time' => new sfValidatorDateTime(array('required' => false)),
      'last_login_time'  => new sfValidatorDateTime(array('required' => false)),
      'avatar'           => new sfValidatorString(array('required' => false)),
      'is_activate_b'    => new sfValidatorInteger(array('required' => false)),
      'login_ip'         => new sfValidatorString(array('max_length' => 30, 'required' => false)),
      'join_ip'          => new sfValidatorString(array('max_length' => 30, 'required' => false)),
      'member_level_i'   => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('users[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Users';
  }

}
